package com.ssm.subject.infra.basic.service.impl;

import com.alibaba.fastjson.JSON;
import com.ssm.subject.infra.basic.entity.SubjectLabel;
import com.ssm.subject.infra.basic.mapper.SubjectLabelDao;
import com.ssm.subject.infra.basic.service.SubjectLabelService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 题目标签表(SubjectLabel)表服务实现类
 *
 * @author makejava
 * @since 2024-11-27 19:03:13
 */
@Service("subjectLabelService")
@Log4j2
public class SubjectLabelServiceImpl implements SubjectLabelService {
    @Resource
    private SubjectLabelDao subjectLabelDao;

    /**
     * 新增标签
     *
     * @param subjectLabel 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(SubjectLabel subjectLabel) {
        if(log.isInfoEnabled()) {
            log.info("SubjectLabelService.add.subjectLabel:{}", JSON.toJSONString(subjectLabel));
        }
        return this.subjectLabelDao.insert(subjectLabel);
    }

    /**
     * 更新标签
     *
     * @param subjectLabel 实例对象
     * @return 实例对象
     */
    @Override
    public int update(SubjectLabel subjectLabel) {
        if(log.isInfoEnabled()) {
            log.info("SubjectLabelService.update.subjectLabel:{}", JSON.toJSONString(subjectLabel));
        }
        return this.subjectLabelDao.update(subjectLabel);
    }

    /**
     * 根据id批量查询
     * @param labelIds
     * @return
     */
    @Override
    public List<SubjectLabel> queryByLabelIds(List<Long> labelIds) {
        return subjectLabelDao.queryByLabelIds(labelIds);
    }

    @Override
    public List<SubjectLabel> queryByCondtion(SubjectLabel subjectLabel) {
        return this.subjectLabelDao.queryByCondtion(subjectLabel);
    }

}
